added SSCLI 1.0
[windows-sources.git] / sdk / samples / all in on code / Visual Studio 2008 / CppCOMClient / RawAPI.h
blob5d075f2c856a44c987849fa670bf223a1703b534
1 /****************************** Module Header ******************************\
2 * Module Name: RawAPI.h
3 * Project: CppCOMClient
4 * Copyright (c) Microsoft Corporation.
5 *
6 * This file demontrates the use of C/C++ and the COM APIs to automate a server.
7 * C/C++ Automation is much more difficult, but sometimes necessary to avoid
8 * overhead with MFC, or problems with #import. Basically, you work with such
9 * APIs as CoCreateInstance(), and COM interfaces such as IDispatch and IUnknown.
11 * References
12 * http://support.microsoft.com/kb/216686
13 * http://support.microsoft.com/kb/238393
14 * http://support.microsoft.com/kb/216388
16 * This source is subject to the Microsoft Public License.
17 * See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
18 * All other rights reserved.
20 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
21 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
22 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
23 \***************************************************************************/
25 #pragma once
27 #pragma region Includes
28 #include <ole2.h> // OLE2 Definitions
29 #pragma endregion
32 /*!
33 * \brief
34 * RawConsumeSTAComponent - Create and access a STA COM object by calling the
35 * COM API directly from C++.
37 * \param lpParam
38 * \returns
39 * The prototype of a function that serves as the starting address for a
40 * thread
42 DWORD WINAPI RawConsumeSTAComponent(LPVOID lpParam);
45 /*!
46 * \brief
47 * Automation helper function.
49 * \param autoType
50 * DISPATCH_PROPERTYGET || DISPATCH_PROPERTYPUT || DISPATCH_PROPERTYPUTREF
51 * || DISPATCH_METHOD
53 * \param pvResult
54 * Holds the return value in a VARIANT
56 * \param pDisp
57 * The IDispatch interface
59 * \param ptName
60 * The property/method name exposed by the interface
62 * \param cArgs
63 * The count of the arguments
65 * \returns
66 * HRESULT
68 * The AutoWrap() function simplifies most of the low-level details involved
69 * with using IDispatch directly. Feel free to use it in your own
70 * implementations. One caveat is that if you pass multiple parameters, they
71 * need to be passed in reverse-order.
73 * \example
74 * AutoWrap(
75 * DISPATCH_METHOD, NULL, pDisp, L"call", 3, parm[2], parm[1], parm[0]);
77 HRESULT AutoWrap(int autoType, VARIANT *pvResult, IDispatch *pDisp,
78 LPOLESTR ptName, int cArgs...);